package net.osc.model.job;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import net.osc.model.BaseEntity;



/**
 * 通用定时任务
 * 
 * @author <a mailto=peng.wu@foxmail.com>wu.peng</a> 2012-12-14
 * 
 */
@Entity
@Table(name = "common_job_detail")
public class CommonJobDetail extends BaseEntity {

	/** 作业名 */
	private String jobName;

	/** Beand在Spring 容器中的Id */
	private String beanName;

	/** 运行Beand的方法名 */
	private String methodName;

	/** 是否活动 */
	private Boolean isActive;

	/** 是否并发 */
	private Boolean isConcurrent;

	/** 定时表达时 */
	private String cronExpr;

	/** 任务开始时间 */
	private Date startTime;

	/** 任务结束时间 */
	private Date endTime;

	/** 下次执行时间 */
	private Date nextFireTime;

	/** 上次执行时间 */
	private Date previousFireTime;

	/** 描述 */
	private String description;

	@Column(name = "job_name", length = 200)
	public String getJobName() {
		return jobName;
	}

	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	@Column(name = "bean_name", length = 200)
	public String getBeanName() {
		return beanName;
	}

	public void setBeanName(String beanName) {
		this.beanName = beanName;
	}

	@Column(name = "method_name", length = 200)
	public String getMethodName() {
		return methodName;
	}

	public void setMethodName(String methodName) {
		this.methodName = methodName;
	}

	@Column(name = "is_active")
	public Boolean getIsActive() {
		return isActive;
	}

	public void setIsActive(Boolean isActive) {
		this.isActive = isActive;
	}

	@Column(name = "is_concurrent")
	public Boolean getIsConcurrent() {
		return isConcurrent;
	}

	public void setIsConcurrent(Boolean isConcurrent) {
		this.isConcurrent = isConcurrent;
	}

	@Column(name = "cron_expr", length = 200)
	public String getCronExpr() {
		return cronExpr;
	}

	public void setCronExpr(String cronExpr) {
		this.cronExpr = cronExpr;
	}

	@Column(name = "start_time")
	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	@Column(name = "end_time")
	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	@Column(name = "next_fire_time")
	public Date getNextFireTime() {
		return nextFireTime;
	}

	public void setNextFireTime(Date nextFireTime) {
		this.nextFireTime = nextFireTime;
	}

	@Column(name = "previous_fire_time")
	public Date getPreviousFireTime() {
		return previousFireTime;
	}

	public void setPreviousFireTime(Date previousFireTime) {
		this.previousFireTime = previousFireTime;
	}

	@Column(name = "description", length = 500)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Transient
	public String getTriggerName() {
		return this.getJobName() + "-Trigger";
	}

}
